#ifndef DEALLOGICOBJ_H
#define DEALLOGICOBJ_H

#include <QObject>
#include "protocol.h"
#include <functional>
#include <QMap>
#include <memory>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
//
class TcpUserConnect;
class UserService;
class SearchService;
class FriendService;
//
class DealLogicObj : public QObject
{
    Q_OBJECT
public:
    explicit DealLogicObj(QObject *parent = nullptr);

    void DoHandler(myuint Sig,std::shared_ptr<PDU> Msg,TcpUserConnect* UserPtr);

    static DealLogicObj & getInstance();

signals:


public slots:
private:
    QMap<myuint,std::function<void(std::shared_ptr<PDU>,TcpUserConnect*)>> WorkHandler;

    void RegisterWork(myuint Sig,std::function<void(std::shared_ptr<PDU>,TcpUserConnect*)>Handler);

    void Work();

    UserService * UserServer;
    SearchService * SearchServer;
    FriendService * FriendServer;

};

#endif // DEALLOGICOBJ_H
